class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        map<int, int> dp;
        for (int cur = 0; cur < nums.size(); cur++)
        {
            int num = nums[cur];
            int sign = target - num;
            if (dp.count(sign))
            {
                return { dp[sign] , cur };
            }
            dp[num] = cur;
        }
        return { 0,0 };
    }
};
class Solution {
public:
    bool CheckPermutation(string s1, string s2) {
        if (s1.size() != s2.size())
            return false;
        map<char, int> dp;
        for (char ch : s1)
            dp[ch]++;
        for (char ch : s2)
        {
            if (dp[ch]) dp[ch]--;
            else return false;
        }
        return true;
    }
};
class Solution {
public:
    bool containsDuplicate(vector<int>& nums) {
        map<int, int> dp;
        for (auto ch : nums)
        {
            if (dp.count(ch)) return true;
            dp[ch]++;
        }
        return false;
    }
};
